function a(a) {
    var s = a;
    a = a.split("转")[0];
    var e = {}, t = new Date().getHours(), i = "w", l = "day";
    switch (t > 18 || t < 6 ? (i = "n", l = "night") : (i = "w", l = "day"), a) {
      case "--":
        a = "/images/w/" + i + "01", e.status = s, e.wall = "/images/clear" + l;
        break;

      case "晴":
        a = "/images/w/" + i + "00", e.status = s, e.wall = "/images/clear" + l;
        break;

      case "多云":
        a = "/images/w/" + i + "01", e.status = s, e.wall = "/images/cloud" + l;
        break;

      case "阴":
        a = "/images/w/" + i + "02", e.status = s, e.wall = "/images/cloud" + l;
        break;

      case "阵雨":
        a = "/images/w/" + i + "03", e.status = s, e.wall = "/images/rainy" + l;
        break;

      case "雷阵雨":
        a = "/images/w/" + i + "04", e.status = s, e.wall = "/images/rainy" + l;
        break;

      case "雷阵雨伴有冰雹":
        a = "/images/w/" + i + "05", e.status = s, e.wall = "/images/rainy" + l;
        break;

      case "雨夹雪":
        a = "/images/w/" + i + "06", e.status = s, e.wall = "/images/rainy" + l;
        break;

      case "小雨":
        a = "/images/w/" + i + "07", e.status = s, e.wall = "/images/rainy" + l;
        break;

      case "中雨":
        a = "/images/w/" + i + "08", e.status = s, e.wall = "/images/rainy" + l;
        break;

      case "大雨":
        a = "/images/w/" + i + "09", e.status = s, e.wall = "/images/rainy" + l;
        break;

      case "暴雨":
        a = "/images/w/" + i + "10", e.status = s, e.wall = "/images/rainy" + l;
        break;

      case "大暴雨":
        a = "/images/w/" + i + "11", e.status = s, e.wall = "/images/rainy" + l;
        break;

      case "特大暴雨":
        a = "/images/w/" + i + "12", e.status = s, e.wall = "/images/rainy" + l;
        break;

      case "阵雪":
        a = "/images/w/" + i + "13", e.status = s, e.wall = "/images/snow" + l;
        break;

      case "小雪":
        a = "/images/w/" + i + "14", e.status = s, e.wall = "/images/snow" + l;
        break;

      case "中雪":
        a = "/images/w/" + i + "15", e.status = s, e.wall = "/images/snow" + l;
        break;

      case "大雪":
        a = "/images/w/" + i + "16", e.status = s, e.wall = "/images/snow" + l;
        break;

      case "暴雪":
        a = "/images/w/" + i + "17", e.status = s, e.wall = "/images/snow" + l;
        break;

      case "雾":
        a = "/images/w/" + i + "18", e.status = s, e.wall = "/images/cloud" + l;
        break;

      case "冻雨":
        a = "/images/w/" + i + "19", e.status = s, e.wall = "/images/rainy" + l;
        break;

      case "沙尘暴":
        a = "/images/w/" + i + "20", e.status = s, e.wall = "/images/sandday";
        break;

      case "小到中雨":
        a = "/images/w/" + i + "21", e.status = s, e.wall = "/images/rainy" + l;
        break;

      case "中到大雨":
        a = "/images/w/" + i + "22", e.status = s, e.wall = "/images/rainy" + l;
        break;

      case "大到暴雨":
        a = "/images/w/" + i + "23", e.status = s, e.wall = "/images/rainy" + l;
        break;

      case "暴雨到大暴雨":
        a = "/images/w/" + i + "24", e.status = s, e.wall = "/images/rainy" + l;
        break;

      case "大暴雨到特大暴雨":
        a = "/images/w/" + i + "25", e.status = s, e.wall = "/images/rainy" + l;
        break;

      case "小到中雪":
        a = "/images/w/" + i + "26", e.status = s, e.wall = "/images/snow" + l;
        break;

      case "中到大雪":
        a = "/images/w/" + i + "27", e.status = s, e.wall = "/images/snow" + l;
        break;

      case "大到暴雪":
        a = "/images/w/" + i + "28", e.status = s, e.wall = "/images/snow" + l;
        break;

      case "浮尘":
        a = "/images/w/" + i + "29", e.status = s, e.wall = "/images/sandday";
        break;

      case "扬沙":
        a = "/images/w/" + i + "30", e.status = s, e.wall = "/images/sandday";
        break;

      case "强沙尘暴":
        a = "/images/w/" + i + "32", e.status = s, e.wall = "/images/sandday";
        break;

      case "霾":
        a = "/images/w/" + i + "32", e.status = s, e.wall = "/images/cloud" + l;
        break;

      case "无":
      default:
        a = "/images/w/" + i + "01", e.status = s, e.wall = "/images/clear" + l;
    }
    return e.icon = a, e;
}

var s = [], e = 0, t = require("bmap-wx.js");

module.exports = {
    readXJCitys: function() {
        return JSON.parse('{"province":[{"cityzh":"北京市","location":"116.5,39.9"},{"cityzh":"天津市","location":"117.2,39.1"},{"cityzh":"上海市","location":"121.5,31.15"},{"cityzh":"重庆市","location":"106.5,29.5"},{"cityzh":"石家庄市","location":"114.52,38.04"},{"cityzh":"郑州市","location":"113.63,34.75"},{"cityzh":"武汉市","location":"114.31,30.59"},{"cityzh":"长沙市","location":"112.94,28.23"},{"cityzh":"南京市","location":"118.80,32.06"},{"cityzh":"南昌市","location":"115.86,28.68"},{"cityzh":"沈阳市","location":"123.43,41.81"},{"cityzh":"长春市","location":"125.33,43.82"},{"cityzh":"哈尔滨市","location":"126.54,45.80"},{"cityzh":"西安市","location":"108.94,34.34"},{"cityzh":"太原市","location":"112.55,37.87"},{"cityzh":"济南市","location":"117.02,36.68"},{"cityzh":"成都市","location":"104.07,30.57"},{"cityzh":"西宁市","location":"101.78,36.62"},{"cityzh":"合肥市","location":"117.23,31.82"},{"cityzh":"海口市","location":"110.20,20.05"},{"cityzh":"广州市","location":"113.27,23.13"},{"cityzh":"贵阳市","location":"106.63,26.65"},{"cityzh":"杭州市","location":"120.16,30.28"},{"cityzh":"福州市","location":"119.30,26.08"},{"cityzh":"兰州市","location":"103.84,36.06"},{"cityzh":"昆明市","location":"102.83,24.88"},{"cityzh":"拉萨市","location":"91.12,29.65"},{"cityzh":"银川市","location":"106.23,38.49"},{"cityzh":"南宁市","location":"108.37,22.82"},{"cityzh":"乌鲁木齐市","location":"87.62,43.83"},{"cityzh":"呼和浩特市","location":"111.75,40.84"},{"cityzh":"香港市","location":"114.17,22.28"},{"cityzh":"澳门市","location":"113.54,22.19"}]}');
    },
    init: function() {
        try {
            var a = new t.BMapWX({
                ak: "UnMeMmKOwfL2jYjTq1VU3TAgCIsqb6Gf"
            }), i = wx.getStorageSync("citys");
            i ? (console.log("有缓存"), s = i) : (console.log("没有缓存"), a.weather({
                fail: function(a) {
                    console.log(a);
                },
                success: function(a) {
                    var t = a.currentWeather[0];
                    t.fullData = a.originalData.results[0], s.push(t), e = 0;
                    try {
                        wx.setStorageSync("citys", s), wx.setStorageSync("index", e);
                    } catch (a) {}
                }
            }));
        } catch (a) {
            console.log("缓存出问题啦!");
        }
    },
    getHomeData: function() {
        return s[e];
    },
    getCityList: function() {
        for (var a = [], t = 0; t < s.length; t++) {
            var i = {};
            i.name = s[t].currentCity, i.index = t, i.icon = e == t ? 0 : 1, a.push(i);
        }
        return a;
    },
    addCity: function(a) {
        for (var e = -1, t = 0; t < s.length; t++) s[t].currentCity == a.currentCity && (e = t);
        -1 == e && (s.push(a), wx.setStorageSync("citys", s));
    },
    refreshCity: function(a) {
        e = wx.getStorageSync("index");
        for (var t = -1, i = 0; i < s.length; i++) s[i].currentCity == a.currentCity && (s[i] = a, 
        t = i);
        -1 == t ? (s.push(a), e = s.length - 1) : e = t, wx.setStorageSync("index", e);
    },
    getToday: function() {
        var a = new Date();
        return a.getFullYear() + "年 " + (a.getMonth() + 1) + "月 " + a.getDate() + "日";
    },
    getCity: function() {
        return s;
    },
    iconChanger: function(s) {
        var e = s, t = {}, i = new Date().getHours(), l = "w", c = "day";
        switch (i > 18 || i < 6 ? (l = "n", c = "night") : (l = "w", c = "day"), s) {
          case "--":
            s = "/images/w/" + l + "01", t.status = e, t.wall = "/images/clear" + c;
            break;

          case "晴":
            s = "/images/w/" + l + "00", t.status = e, t.wall = "/images/clear" + c;
            break;

          case "多云":
            s = "/images/w/" + l + "01", t.status = e, t.wall = "/images/cloud" + c;
            break;

          case "阴":
            s = "/images/w/" + l + "02", t.status = e, t.wall = "/images/cloud" + c;
            break;

          case "阴转小雨":
            s = "/images/w/" + l + "03", t.wall = "/images/clear" + c;
            break;

          case "阵雨":
            s = "/images/w/" + l + "03", t.status = e, t.wall = "/images/rainy" + c;
            break;

          case "雷阵雨":
            s = "/images/w/" + l + "04", t.status = e, t.wall = "/images/rainy" + c;
            break;

          case "雷阵雨伴有冰雹":
            s = "/images/w/" + l + "05", t.status = e, t.wall = "/images/rainy" + c;
            break;

          case "雨夹雪转大雪":
          case "雨夹雪":
            s = "/images/w/" + l + "06", t.status = e, t.wall = "/images/rainy" + c;
            break;

          case "小雨":
            s = "/images/w/" + l + "07", t.status = e, t.wall = "/images/rainy" + c;
            break;

          case "中雨":
            s = "/images/w/" + l + "08", t.status = e, t.wall = "/images/rainy" + c;
            break;

          case "大雨":
            s = "/images/w/" + l + "09", t.status = e, t.wall = "/images/rainy" + c;
            break;

          case "暴雨":
            s = "/images/w/" + l + "10", t.status = e, t.wall = "/images/rainy" + c;
            break;

          case "大暴雨":
            s = "/images/w/" + l + "11", t.status = e, t.wall = "/images/rainy" + c;
            break;

          case "特大暴雨":
            s = "/images/w/" + l + "12", t.status = e, t.wall = "/images/rainy" + c;
            break;

          case "阵雪":
            s = "/images/w/" + l + "13", t.status = e, t.wall = "/images/snow" + c;
            break;

          case "小雪":
            s = "/images/w/" + l + "14", t.status = e, t.wall = "/images/snow" + c;
            break;

          case "中雪":
            s = "/images/w/" + l + "15", t.status = e, t.wall = "/images/snow" + c;
            break;

          case "大雪":
            s = "/images/w/" + l + "16", t.status = e, t.wall = "/images/snow" + c;
            break;

          case "暴雪":
            s = "/images/w/" + l + "17", t.status = e, t.wall = "/images/snow" + c;
            break;

          case "雾":
            s = "/images/w/" + l + "18", t.status = e, t.wall = "/images/cloud" + c;
            break;

          case "冻雨":
            s = "/images/w/" + l + "19", t.status = e, t.wall = "/images/rainy" + c;
            break;

          case "沙尘暴":
            s = "/images/w/" + l + "20", t.status = e, t.wall = "/images/sandday";
            break;

          case "小到中雨":
            s = "/images/w/" + l + "21", t.status = e, t.wall = "/images/rainy" + c;
            break;

          case "中到大雨":
            s = "/images/w/" + l + "22", t.status = e, t.wall = "/images/rainy" + c;
            break;

          case "大到暴雨":
            s = "/images/w/" + l + "23", t.status = e, t.wall = "/images/rainy" + c;
            break;

          case "暴雨到大暴雨":
            s = "/images/w/" + l + "24", t.status = e, t.wall = "/images/rainy" + c;
            break;

          case "大暴雨到特大暴雨":
            s = "/images/w/" + l + "25", t.status = e, t.wall = "/images/rainy" + c;
            break;

          case "小到中雪":
            s = "/images/w/" + l + "26", t.status = e, t.wall = "/images/snow" + c;
            break;

          case "中到大雪":
            s = "/images/w/" + l + "27", t.status = e, t.wall = "/images/snow" + c;
            break;

          case "大到暴雪":
            s = "/images/w/" + l + "28", t.status = e, t.wall = "/images/snow" + c;
            break;

          case "浮尘":
            s = "/images/w/" + l + "29", t.status = e, t.wall = "/images/sandday";
            break;

          case "扬沙":
            s = "/images/w/" + l + "30", t.status = e, t.wall = "/images/sandday";
            break;

          case "强沙尘暴":
            s = "/images/w/" + l + "32", t.status = e, t.wall = "/images/sandday";
            break;

          case "霾":
            s = "/images/w/" + l + "32", t.status = e, t.wall = "/images/cloud" + c;
            break;

          case "无":
            s = "/images/w/" + l + "01", t.status = e, t.wall = "/images/clear" + c;
            break;

          default:
            return console.log(" **************** 没有匹配到: " + s), t = a(s), t.status = e, t;
        }
        return t.icon = s, t;
    },
    windHelper: function(a) {
        return a;
    },
    pmText: function(a) {
        return a <= 35 ? "空气质量优" : a > 35 && a <= 75 ? "空气质量良好" : a > 75 && a <= 115 ? "空气轻度污染" : a > 115 && a <= 150 ? "空气中度污染" : a > 150 && a <= 250 ? "空气重度污染" : a > 250 ? "空气非常污染" : void 0;
    }
};